package com.romotc.qqrobot.bean;

import java.util.List;

public class RobotUserSubQqService {
	private static RobotUserSubQq subQq = new RobotUserSubQq();
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println(qrySubQQ("99999").getPswd());

	}

	
	/**
	 * 根据QQ号码查询是否为子号
	 * @param uin
	 * @return
	 */
	public static RobotUserSubQq qrySubQQ(String uin) {
		List<RobotUserSubQq> subQQ = (List<RobotUserSubQq>)subQq.Filter("qqNum = " + uin, 1, 1);
		if(subQQ != null && !subQQ.isEmpty())
			return subQQ.get(0);
		return null;
	}


	/**
	 * 查询好友数量最少的一个子号
	 * @param uid
	 * @return
	 */
	public static RobotUserSubQq qryMinFriendsSubQQ(long uid) {
		String filter = "uid = " + uid;
		List<RobotUserSubQq> subqqList = (List<RobotUserSubQq>)subQq
			.FilterOrderBy(filter, "friendsSize ASC", 1, 1);
		
		if(subqqList != null && !subqqList.isEmpty())
			return subqqList.get(0);
		return null;
	}

}
